import {upload_file} from './upload.js'
const install = (Vue, vm) => {
	let config = async (params={}) => await vm.$u.get('/addons/keesuishoupai/api.common/init', params)
	//验证码
	let captcha = async (params={}) => await vm.$u.get('/addons/keesuishoupai/api.common/captcha', params)
	let getUserInfo = async (params={}) => await vm.$u.get('/addons/keesuishoupai/api.user/getUserInfo', params)
	
	//公开
	let getReportOpenList = async (params={}) => await vm.$u.get('/addons/keesuishoupai/api.report/getOpenList', params)
	//上报详情
	let getReportDetail = async (params={}) => await vm.$u.get('/addons/keesuishoupai/api.report/getDetail', params)
	//我的上报
	let getReportMyList = async (params={}) => await vm.$u.get('/addons/keesuishoupai/api.report/getMyList', params)
	//上报
	let submitReport = async (params={}) => await vm.$u.post('/addons/keesuishoupai/api.report/submit', params)	

	//商品列表
	let getScoreshopGoodList = async (params={}) => await vm.$u.get('/addons/keesuishoupai/api.scoreshop/getGoodList', params)
	//商品详情
	let getScoreshopGoodDetail = async (params={}) => await vm.$u.get('/addons/keesuishoupai/api.scoreshop/getGoodDetail', params)
	//兑换记录
	let getScoreshopOrderList = async (params={}) => await vm.$u.get('/addons/keesuishoupai/api.scoreshop/getOrderList', params)
	//兑换详情
	let getScoreshopOrderDetail = async (params={}) => await vm.$u.get('/addons/keesuishoupai/api.scoreshop/getOrderDetail', params)
	//积分明细
	let getScorelogList = async (params={}) => await vm.$u.get('/addons/keesuishoupai/api.user/getScorelogList', params)
	//兑换操作
	let doExchange = async (params={}) => await vm.$u.post('/addons/keesuishoupai/api.scoreshop/doExchange', params)

	//登出
	let logout = async (params = {}) => await vm.$u.get('/addons/keesuishoupai/api.user/logout', params)
	//微信小程序登录
	let wxQuickLogin = async (params = {}) => await vm.$u.post('/addons/keesuishoupai/api.login/wxQuickLogin', params)
	//更新头像
	let updateAvatar = async (params = {}) => await vm.$u.post('/addons/keesuishoupai/api.user/avatar', params)
	//更新用户基本信息
	let updateProfile = async (params = {}) => await vm.$u.post('/addons/keesuishoupai/api.user/saveProfile', params)
	let upload = async (params = {}) => await upload_file(vm, params);
	
	vm.$u.api = {
		config, 
		captcha,
		getUserInfo,
		getReportOpenList,
		getReportDetail,
		getReportMyList,
		submitReport,
		logout,
		wxQuickLogin,
		updateAvatar,
		updateProfile,
		getScoreshopGoodList,
		getScoreshopGoodDetail,
		getScoreshopOrderList,
		getScoreshopOrderDetail,
		getScorelogList,
		doExchange,
		upload,
	};
	
}
export default {
	install
}
